(function ($, window) {
    var baseRequest = window.baseRequest;
    var appConfig = window.appConfig;
    var commonTool = window.commonTool;
    var dataManager = window.dataManager;
    var baseUrl = appConfig.v3ServiceUrl;
	var v3BaseReset = window.v3BaseReset = {};

    //add by dongyi
	var deviceOperationUrl = baseUrl + "/base/resetDev";
    v3BaseReset.deviceOperation = function(devSN,saveConfig,callback){
		baseRequest.commonPost(deviceOperationUrl, {devSN: devSN,saveConfig:saveConfig}, function (code, data) {
	        if (code === 2 || code === 1) {
	            return callback(2);
	        }
	        if(code === 0){
	        		callback(0,data);
	        }else{
	        		callback(1);
	        }
        });
    }
    
    var mainLinkReconnectUrl = baseUrl + "/base/resetConnection";
    v3BaseReset.mainLinkReconnect = function(devSN,callback){
    	baseRequest.commonPost(mainLinkReconnectUrl, {devSN: devSN}, function (code, data) {
	        if (code === 2 || code === 1) {
	            return callback(2);
	        }
	        if(code === 0){
	        		callback(0,data);
	        }else{
	        		callback(1);
	        }
        });
    }
    
     var getResidualSpaceUrl = baseUrl + "/base/getAllUpdateStatus";
     v3BaseReset.getResidualSpace = function(devSN,callback){
    	baseRequest.commonPost(getResidualSpaceUrl, {devSN: devSN}, function (code, data) {
	        if (code === 2 || code === 1) {
	            return callback(2);
	        }
	        if(code === 0){
	        		callback(0,data);
	        }else{
	        		callback(1);
	        }
        });
    }
    //end

    //add by zhangfuqiang

    //end

    //add by ding
  
    //end

    //add by wangyu

    //end

    //add by wuchengcheng

    //end

})(mui, window);
